
//
//  CinemaCell.m
//  DSYDouban
//
//  Created by dllo on 16/1/1.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "CinemaCell.h"

@interface CinemaCell ()

@property (nonatomic, retain) UIImageView *backgroundImageView;

@end

@implementation CinemaCell

- (void)dealloc
{
    [_backgroundImageView release];
    
    [_cinemaNameLabel release];
    [_addressLabel release];
    [_telephoneLabel release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
}

- (void)create {
    
    self.backgroundImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_backgroundImageView];
    [_backgroundImageView release];
    
    self.cinemaNameLabel = [[UILabel alloc] init];
    [_backgroundImageView addSubview:_cinemaNameLabel];
    [_cinemaNameLabel release];
    
    self.addressLabel = [[UILabel alloc] init];
    [_backgroundImageView addSubview:_addressLabel];
    [_addressLabel release];
    
    self.telephoneLabel = [[UILabel alloc] init];
    [_backgroundImageView addSubview:_telephoneLabel];
    [_telephoneLabel release];
    
}


- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    _backgroundImageView.frame = CGRectMake(10, 10, self.contentView.frame.size.width - 20, self.contentView.frame.size.height - 20);
    _backgroundImageView.image = [UIImage imageNamed:@"bg_eventlistcell.png"];
    
    CGFloat background_W = _backgroundImageView.frame.size.width;
    CGFloat background_H = _backgroundImageView.frame.size.height;
    
    _cinemaNameLabel.frame = CGRectMake(10, 5, background_W - 20, 40);
//    _cinemaNameLabel.backgroundColor = [UIColor greenColor];
    
    _addressLabel.frame = CGRectMake(10, _cinemaNameLabel.frame.origin.y + _cinemaNameLabel.frame.size.height + 15, background_W - 20, 50);
    _addressLabel.font = [UIFont systemFontOfSize:14.0];
    _addressLabel.numberOfLines = 0;
//    _addressLabel.backgroundColor = [UIColor greenColor];
    
    _telephoneLabel.frame = CGRectMake(10, background_H - 35, background_W - 20, 25);
    _telephoneLabel.font = [UIFont systemFontOfSize:14.0];
//    _telephone.backgroundColor = [UIColor greenColor];
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
